Skip to content

Roll Templates

allProps

Alias for templateHelperFunction that sets the function to be allProps.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+allProps({values:'my-roll character_name character_id'})
include k-scaffold
+allProps({values:'my-roll character_name character_id'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#allprops() my-roll character_name character_id}}{{/allprops() my-roll character_name character_id}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#allprops() my-roll character_name character_id}}{{/allprops() my-roll character_name character_id}}

Creates handling for creating a link back to the character that sent the roll.

  • level - number -

    The header level to use for the link

Example

pug
include k-scaffold
+characterLink()
include k-scaffold
+characterLink()

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#character_name}}{{#character_id}}<h4 class="character_name">
  [{{character_name}}](http://journal.roll20.net/character/{{character_id}})
</h4>
  {{/character_id}}{{^character_id}}<h4 class="character_name">
    {{character_name}}
  </h4>
    {{/character_id}}{{/character_name}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#character_name}}{{#character_id}}<h4 class="character_name">
  [{{character_name}}](http://journal.roll20.net/character/{{character_id}})
</h4>
  {{/character_id}}{{^character_id}}<h4 class="character_name">
    {{character_name}}
  </h4>
    {{/character_id}}{{/character_name}}

multiPartTemplate

Creates a rolltemplate wrapper for use in creating multi part roll templates that look like one message, but are actually created from multiple roll messages.

  • name - string -

    The name of the roll template

  • block - block -

    The content of the roll template

Example

pug
include k-scaffold
+multiPartTemplate
  //- Roll template content here Use the provided finished span to conditionally display elements in your scss
include k-scaffold
+multiPartTemplate
  //- Roll template content here Use the provided finished span to conditionally display elements in your scss

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
<rolltemplate class="sheet-rolltemplate-undefined">
  {{#^rollBetween() computed::finished 0 0}}<span class="finished"></span>
  {{/^rollBetween() computed::finished 0 0}}<div class="template undefined{{#continuation}} continuation{{/continuation}}{{#first}} first{{/first}} finished"></div>
</rolltemplate>
<button name="act_k-network-call" hidden="" type="action"></button>
<rolltemplate class="sheet-rolltemplate-undefined">
  {{#^rollBetween() computed::finished 0 0}}<span class="finished"></span>
  {{/^rollBetween() computed::finished 0 0}}<div class="template undefined{{#continuation}} continuation{{/continuation}}{{#first}} first{{/first}} finished"></div>
</rolltemplate>

rollBetween

Alias for templateHelperFunction that sets the function to be rollBetween.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+rollBetween({values:'my-roll 10 20'})
include k-scaffold
+rollBetween({values:'my-roll 10 20'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollBetween() my-roll 10 20}}{{/rollBetween() my-roll 10 20}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollBetween() my-roll 10 20}}{{/rollBetween() my-roll 10 20}}

rollGreater

Alias for templateHelperFunction that sets the function to be rollGreater.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+rollGreater({values:'my-roll 10'})
include k-scaffold
+rollGreater({values:'my-roll 10'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollGreater() my-roll 10}}{{/rollGreater() my-roll 10}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollGreater() my-roll 10}}{{/rollGreater() my-roll 10}}

rollLess

Alias for templateHelperFunction that sets the function to be rollLess.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+rollLess({values:'my-roll 10'})
include k-scaffold
+rollLess({values:'my-roll 10'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollLess() my-roll 10}}{{/rollLess() my-roll 10}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollLess() my-roll 10}}{{/rollLess() my-roll 10}}

rolltemplate

Creates a rolltemplate wrapper around content

  • name - string -

    The name of the roll template

  • block - block -

    The content of the roll template

Example

pug
include k-scaffold
+rolltemplate('my-rolltemplate')
  //- Some roll template content
include k-scaffold
+rolltemplate('my-rolltemplate')
  //- Some roll template content

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
<rolltemplate class="sheet-rolltemplate-my-rolltemplate"></rolltemplate>
<button name="act_k-network-call" hidden="" type="action"></button>
<rolltemplate class="sheet-rolltemplate-my-rolltemplate"></rolltemplate>

rollTotal

Alias for templateHelperFunction that sets the function to be rollTotal.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+rollTotal({values:'my-roll 10'})
include k-scaffold
+rollTotal({values:'my-roll 10'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollTotal() my-roll 10}}{{/rollTotal() my-roll 10}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollTotal() my-roll 10}}{{/rollTotal() my-roll 10}}

rollWasCrit

Alias for templateHelperFunction that sets the function to be rollWasCrit.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+rollWasCrit({values:'my-roll'})
include k-scaffold
+rollWasCrit({values:'my-roll'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollWasCrit() my-roll}}{{/rollWasCrit() my-roll}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollWasCrit() my-roll}}{{/rollWasCrit() my-roll}}

rollWasFumble

Alias for templateHelperFunction that sets the function to be rollWasFumble.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+rollWasFumble({values:'my-roll'})
include k-scaffold
+rollWasFumble({values:'my-roll'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollWasFumble() my-roll}}{{/rollWasFumble() my-roll}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollWasFumble() my-roll}}{{/rollWasFumble() my-roll}}

templateConditionalDisplay

Helper mixin for using the Roll20 Roll Template Logic.

  • fieldBool - string -

    The name of the field to look at to determine if the content should be created

  • invert - boolean -

    Whether to invert the logic (aka show if a field is not present).

  • block - block -

    The content to conditionally display

Example

pug
include k-scaffold
//- Display content if field present
+templateConditionalDisplay('my-field')
  span shown if my-field is used in the template

//- Display content if field is not present
+templateConditionalDisplay('my-field','invert')
  span shown if my-field isn't used in the template
include k-scaffold
//- Display content if field present
+templateConditionalDisplay('my-field')
  span shown if my-field is used in the template

//- Display content if field is not present
+templateConditionalDisplay('my-field','invert')
  span shown if my-field isn't used in the template

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#my-field}}<span>
  shown if my-field is used in the template
</span>
{{/my-field}}{{^my-field}}<span>
  shown if my-field isn't used in the template
</span>
{{/my-field}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#my-field}}<span>
  shown if my-field is used in the template
</span>
{{/my-field}}{{^my-field}}<span>
  shown if my-field isn't used in the template
</span>
{{/my-field}}

templateHelperFunction

Helper function that simplifies using the Roll20 Roll Template Helper Functions.

  • helperObj - object -

    Object describing the helper function and arguments to be used

  • helperObj.func - string -

    The name of the helper function to use.

  • helperObj.values - string -

    The arguments for the helper function

  • helperObj.invert - boolean -

    Whether to invert the function's logic

Example

pug
include k-scaffold
+templateHelperFunction({func:'rollWasCrit',values:'my-roll'})
include k-scaffold
+templateHelperFunction({func:'rollWasCrit',values:'my-roll'})

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollWasCrit() my-roll}}{{/rollWasCrit() my-roll}}
<button name="act_k-network-call" hidden="" type="action"></button>
{{#rollWasCrit() my-roll}}{{/rollWasCrit() my-roll}}

templateWrapper

Creates a nested rolltemplate wrapper. Useful for ensuring you can add enough specificity to your roll template css.

  • name - string -

    The name of the roll template

  • block - block -

    The content of the roll template

Example

pug
include k-scaffold
+templateWrapper('my-template')
include k-scaffold
+templateWrapper('my-template')

Output

html
<button name="act_k-network-call" hidden="" type="action"></button>
<rolltemplate class="sheet-rolltemplate-my-template">
  <div class="template my-template"></div>
</rolltemplate>
<button name="act_k-network-call" hidden="" type="action"></button>
<rolltemplate class="sheet-rolltemplate-my-template">
  <div class="template my-template"></div>
</rolltemplate>

Released under the MIT License